<template>
	<!-- #ifdef MP-WEIXIN -->
	<view class="navbar" :style="{paddingTop:distanceToTop+'px'}">
		<view class="navbar-content u-flex-center u-col-center" :style="{height:navbarHeight+'px'}">
			<image class="img"
				:src="systemConfig.index_head_img != ''?systemConfig.index_head_img:$getImageUrl('/user_client/static/icons/mtj.png')">
			</image>
		</view>
	</view>
	<!-- #endif -->
	<!-- #ifdef APP-PLUS || H5 -->
	<view class="navbar">
		<view class="navbar-content u-flex-center u-col-center">
			<image class="img" :src="$getImageUrl('/user_client/static/icons/mtj.png')"></image>
		</view>
	</view>
	<!-- #endif -->
</template>

<script>
	import {
		mapState
	} from 'vuex'
	export default {
		data() {
			return {
				distanceToTop: 0,
				navbarHeight: 0,
			}
		},
		props: {},
		mounted() {
			// #ifdef MP-WEIXIN
			this.getMenuButtonPosition()
			// #endif 
		},
		computed: {
			...mapState({
				systemConfig: state => state.init.systemConfig,
			}),
		},
		methods: {
			getMenuButtonPosition() {
				const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
				this.distanceToTop = menuButtonInfo.top
				this.navbarHeight = menuButtonInfo.height
			}
		}
	}
</script>

<style lang="scss" scoped>
	.navbar {
		width: 750rpx;
		position: sticky;
		top: 0;
		left: 0;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 0 28rpx 10rpx;
		box-sizing: border-box;
		background-color: $base-index-back;
		z-index: 99;
		// #ifdef APP-PLUS || H5
		padding-top: var(--status-bar-height);
		// #endif

		.navbar-content {
			width: 100%;
			padding-bottom: 24rpx;

			.img {
				width: 170rpx;
				height: 30rpx;
			}
		}
	}
</style>